<template>
	<view>
		<view class="news_item" v-for=" i in list" :key="i.id" @click="navigator(i.id)">
			<image src="../../static/logo.png" ></image>
		
		<view class="news_item_right">
			<view class="tit">
				{{i.title}}
			</view>
			<view class="info">
				<text>发表时间:{{i.add_time | formatDate}}</text>
				<text>浏览:{{i.id}}</text>
			</view>
		</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		props:['list'],
		filters:{
			formatDate(date){
				
				const nDate = new Date(date)
				const year = nDate.getFullYear()
				const month = nDate.getMonth().toString().padStart(2,0)
				const day = nDate.getDate().toString().padStart(2,0)
				return `${year}-${month}-${day}`
			}
		},
		methods: {
			navigator(id){
				this.$emit('itemClick',id)
			}
		}
	}
</script>

<style lang="less">
.news_item{
			display: flex;
			padding: 10rpx 20rpx;
			border-bottom: 1px solid #b50e03;
			image{
				min-width: 200rpx;
				max-width: 200rpx;
				height: 150rpx;
			}
			.news_item_right{
				margin-left:15rpx ;
				display: flex;
				flex-direction: column;
				justify-content:space-between;
				
				.tit{
					font-size: 30rpx;
				}
				.info{
					font-size: 20rpx;
					text:last-child{
						margin-left: 55rpx;
					}
				}
			}
			
		}
</style>
